<!DOCTYPE HTML>
<html>
<head>
<!-- -------------------------------------------------------------------------------------------- -->
<!-- -------------------------------------------------------------------------------------------- -->
<!-- SETTINGS -->
<!-- -------------------------------------------------------------------------------------------- -->

<title>Bet on chope, sell your friend!</title>
<meta http-equiv="Content-Language" content="fr">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="description" lang="fr" content=".">
<meta name="robots" content="index, follow">
<meta name="Revisit-after" content="10 days">
<meta name="Date-Creation-yyyymmdd" content="20071216">
<meta name="Date-Revision-yyyymmdd" content="20110104">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="imagetoolbar" content="no">
<meta http-equiv="expires" content="never">

<!-- -------------------------------------------------------------------------------------------- -->
<!-- -------------------------------------------------------------------------------------------- -->
<!-- LIB INCLUDES -->
<!-- -------------------------------------------------------------------------------------------- -->
<!--<script type="text/javascript" src="http://fbug.googlecode.com/svn/lite/branches/firebug1.4/content/firebug-lite-dev.js"></script>-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="{{ STATIC_URL}}javascript/jquery.min1.7.2.js"></script>
<script type="text/javascript" src="{{ STATIC_URL}}javascript/extendAjaxForCSRF.js"></script>
<script type="text/javascript" src="{{ STATIC_URL}}javascript/libs.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL}}javascript/candy.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL}}javascript/extendAjaxForCSRF.js"></script>

<!-- the following include allow internet explorer to keep the same display than the other browser -->
<!--[if lt IE 10]>
	<script type="text/javascript" src="{{ STATIC_URL}}javascript/CSS3PIE.js"></script>
<![endif]-->

<!-- -------------------------------------------------------------------------------------------- -->
<!-- -------------------------------------------------------------------------------------------- -->
<!-- STYLE AND PAGE STRUCTURE INCLUDES -->
<!-- -------------------------------------------------------------------------------------------- -->
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL}}css/structure.css">
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL}}css/chat.css">
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/market.css" />

<script language="JavaScript" type="text/javascript" src="{{ STATIC_URL}}javascript/headerStructure.js"></script>
<script type="text/javascript" src="{{ STATIC_URL}}javascript/submitUtils.js"></script>

<!-- -------------------------------------------------------------------------------------------- -->
<!-- -------------------------------------------------------------------------------------------- -->
<!--WIDGETS, GRAPHS AND CHARTS-->
<!-- -------------------------------------------------------------------------------------------- -->
<!--To keep the number of connections to the server as low as possible, we will have only one request for all the tables and charts displaid in
the website. This request will be a post request in order to avoid proxy caching. The return of this request will be a dictionnary of jsons.
the entries for those jsons will be defined in each of the include ".js" but the internal content of them will be hard coded from the python source.
We will then apply a displaying function to each of the returned json. 
-->
<!-- -------------------------------------------------------------------------------------------- -->
<!-- We start by including a json collector which will gather all the require informations from the following includes.
It Mostly defines the global allJsonsRegistry variable witch is a list of couple (func_name_in_py, func_name_in_js)
the meaning of this couple is define in the next comment blocks-->
<script type="text/javascript" src="{{ STATIC_URL}}javascript/allJsonsCollector.js"></script>
<!-- -------------------------------------------------------------------------------------------- -->
<!-- now we set all the json we want. each include must register into the allJsonsRegistry variable:
- The name func_name_in_py of the pyhon function it calls in the python server code to generate the json.
  This function is required to have a single argument which is the player sendind the request
- The name func_name_in_js of the  function we will apply to the returned json
  it also need to implement the function whose name is func_name_in_js-->
  
<!-- -------------------------------------------------------------------------------------------- -->
<!-- -------------------------------------------------------------------------------------------- -->
<!--WIDGETS, GRAPHS AND CHARTS-->
<!-- -------------------------------------------------------------------------------------------- -->
<script type="text/javascript" src="{{ STATIC_URL}}javascript/playerMainViewDataTable.js"></script>
<script type="text/javascript" src="{{ STATIC_URL}}javascript/pricesHistoryChart.js"></script>
<!-- -------------------------------------------------------------------------------------------- -->
<!--we then call the function dispatcher which will call the function func_in_py and apply the func_in_js to the json which is returned
for all the charts/table which have been registered.-->
<script type="text/javascript" src="{{ STATIC_URL}}javascript/allJsonsDispacher.js"></script>

<!-- -------------------------------------------------------------------------------------------- -->
<!-- -------------------------------------------------------------------------------------------- -->
<!-- INITIALISATION OF THE PAGE -->
<!-- -------------------------------------------------------------------------------------------- -->
<script language="JavaScript" type="text/javascript" src="{{ STATIC_URL}}javascript/chatLayout.js"></script>
<script type="text/javascript" src="{{ STATIC_URL}}javascript/coreOnLoad.js"></script>
<script type="text/javascript" src="{{ STATIC_URL}}javascript/marketOnLoad.js"></script>

</head>


<body>

    {% load argTemplates %}
    {% load binaryOPerationTemplateTag %}

    <!-- create the header-->
    <script language="JavaScript" type="text/javascript">makeHeader(
        'probaMkt',
        3,
        '{{player.getName}}',
        '{{player.dbPlayer.mainStrategy.betroom.name}}',
        0,//room type
        {{player.dbPlayer.mainStrategy.betroom.status}},
        '{{STATIC_URL}}'
     );</script>
    <noscript> <p> Activez Javascript pour voir le menu !</p></noscript>
    
    <div class="section">  <h1>Strategies</h1> </div>

    <div class="section">
     <h2>Current strategy</h2>
     
         <div class="myToWayToChangeStrat">

            <!--add the table to display and chang the repartition-->
            <div class="displayAndsubmitNewRep" id="displayAndsubmitNewRep">
                <div><h3 align="left"> You can set a new repartition of asset in your strategy using the last column</h3></div>
                <div align="left">
                    <div>
                        "Number perc" is the percentage of the number of assets. For instance if you have 200 assets in your fund and 5&#37; on
                         the asset X, then you have 10 assets X. Those percentages are used to estimate the market prices. You can change "Number perc" 
                         using the last column of the table.
                    </div>
                    <div>
                        "Current MtM perc" is the percentage of the value due to the asset. If you have 10 assets X and its price is 8 
                        Chochoros and your fund is worth 800 chochoros,then the MtM percentage of the asset X is 10&#37;.
                    </div>
                </div>
                 <div class="onLines">
                    <table class="oneLine myTable" id="playerTable_div"></table>
                    <div class="oneLine smallVSpace"></div>
                    <div class="oneLine">
                        <input class="myRoundCorners myRight" type="submit" onclick="submitNewRepartition('{{ STATIC_URL }}')" value="Set my new strategy repartition"/>
                    </div>
                    <div class="oneLine" id="id_messageDivRep" style="color:Red;"></div>
                </div>
             </div>  <!--<div id="displayAndsubmitNewRep">--> 

            
            <!--add the button to sell assets-->
            <div class="sellAsset" >
                <div><h3 align="left">Selling an asset against the equivalent amount of an other</h3></div>
                <div align="left">Alternatively to the use of the last column of the table above, you can modify your number of assets
                 in your fund selling one to buy another. Use the table above to know how many assets you have.</div>
                <div class="myCenter" id="sellAsset_id" >I want to sell
                    <td>
                        <input name="numberSold" id="id_numberSold"  type="text" size="5%"  value="0">
                    </td>
                    <select name="soldAsset" id="id_soldAsset">
                        {% for asset in market.assets %}
                        <option>
                        {{asset.name}} {% endfor %}
                    </select>
                    to buy 
                    <select name="boughtAsset" id="id_boughtAsset">
                        {% for asset in market.assets %}
                        <option>
                        {{asset.name}} {% endfor %}
                    </select>
                    <input class="myRoundCorners" type="submit" onclick="sellAsset('{{STATIC_URL}}')" value="Sell!"/>
                </div>
                <div class="oneLine" id="id_messageDivSell" style="color:Red;"></div>
            </div> 
        
        </div><!--<div id="myToWayToChangeStrat">-->

    </div><!--end of section-->
    
    <div class="section">
        <h2>Market history</h2>	
         <div class="market_charts_container">   
              <div id="priceschart_div"></div>
          </div>
    </div>
    
<div>
<script language="JavaScript" type="text/javascript">footer()</script>
</div>

</body>
</html>